package cn.juque.datapipeline.service.impl;

import cn.juque.datapipeline.constans.BusinessConstants;
import cn.juque.datapipeline.helper.TaskInfoHelper;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author juque
 * @version 1.0.0
 * <ul>
 *     <li>TaskGroupJobjServiceImpl</li>
 * </ul>
 * @date 2023-04-07 15:12:39
 **/
@Service("taskGroupJobService")
public class TaskGroupJobServiceImpl implements Job {

    @Resource
    private TaskInfoHelper taskInfoHelper;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
        String groupId = jobDataMap.getString(BusinessConstants.GROUP_ID_KEY);
        taskInfoHelper.startTask(groupId);
    }
}
